Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Session when there's failures to write to a Stream #143

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lattwood
Copy link
Contributor

@lattwood lattwood commented Jan 14, 2025

This pull request introduces a new test to detect a deadlock bug and includes modifications to handle connection write timeouts more robustly. The changes span across multiple files, with the primary focus on ensuring that sessions are closed properly when a write timeout occurs.

New Test for Deadlock Detection:

  • deadlock_test.go: Added a comprehensive test TestTimeoutParallel to simulate and detect a deadlock scenario in yamux streams. This test sets up two streams, stalls one to fill the channel, and verifies if the session closes correctly on write timeout.

Improvements in Connection Write Timeout Handling:

  • session.go: Enhanced the waitForSendErr and sendNoWait functions to ensure that the session is properly closed when a connection write timeout or session shutdown occurs. The changes include:
    • Adding deferred functions to call s.exitErr(err) if an error occurs. [1] [2] [3] [4]

Test Adjustments:

  • session_test.go: Modified the TestSession_PingOfDeath to handle the expected ErrSessionShutdown error when a write times out, ensuring the test accounts for the new session shutdown behaviour.

Closes #142.

I humbly request a callout in changelogs when this bugfix ships :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DefaultConfig has dangerous defaults causing hung Reads
1 participant